<!-- IF S_CHAT_ERROR -->

<div class="forabg">
	<div class="inner"><span class="corners-top"><span></span></span>
		<div class="header">
			<div style="float: left">
				<h4 style="color: white; align: center;">{CHAT_ERROR_MESSAGE}</h4>
			</div>
		</div>
	<span class="corners-bottom"><span></span></span></div>
</div>

<!-- ELSE -->

<!-- IF S_GET_CHAT -->
	<!-- IF S_READ or S_ADD -->
		<!-- BEGIN chatrow -->
		<div id="p{chatrow.MESSAGE_ID}" class="post bg{chatrow.CLASS}">
			<div class="inner"><span class="corners-top"><span></span></span>
				<div class="postbody">
					<!-- IF U_ACP or U_MCP -->
						<ul class="profile-icons">
							<li class="delete-icon"><a href="javascript:void({chatrow.MESSAGE_ID})" title="{L_DELETE_POST}" onClick="delete_post('{chatrow.MESSAGE_ID}')"><span>{L_DELETE_POST}</span></a></li>
						</ul>
					<!-- ENDIF -->
					<div class="content">{chatrow.MESSAGE}</div>
				</div>
				<dl class="postprofile" id="profile{postrow.POST_ID}">
					<dt>{chatrow.USERNAME_FULL}<br />{chatrow.TIME}</dt>
				</dl>
			<span class="corners-bottom"><span></span></span></div>
		</div>
		<!-- END chatrow -->--!--{LAST_ID}
		<!-- IF S_WHOISONLINE -->--!--
			<!-- BEGIN whoisrow -->
				<div>
					<div class="inner">
						<div class="user"><img src="{T_IMAGESET_PATH}/{whoisrow.USER_STATUS}.png" class="online_img" alt="" /> {whoisrow.USERNAME_FULL}</div>
					</div>
				</div>
			<!-- END whoisrow -->--!--{LAST_TIME}--!--{DELAY}--!--{LAST_POST}
		<!-- ENDIF -->
	<!-- ENDIF -->
<!-- ELSE -->
	<!-- IF S_CHAT -->

		<p class="{S_CONTENT_FLOW_END}<!-- IF S_USER_LOGGED_IN --> rightside<!-- ENDIF -->"><!-- IF S_USER_LOGGED_IN -->{LAST_VISIT_DATE}<!-- ELSE -->{CURRENT_TIME}<!-- ENDIF --></p>
		<p>{CURRENT_TIME}</p>
	<!-- ENDIF -->
	<script type="text/javascript">
		<!--
		var form_name = 'postform';
		var text_name = 'message';
		var fieldname = 'chat';
		var last_time = 0;
		var xmlHttp = http_object();
		var last_id = {LAST_ID};
		var type = 'receive';
		var post_time = {TIME};
		var read_interval = 15000;
		var interval = setInterval('handle_send("read", last_id);', read_interval);

		function handle_send(mode, f)
		{
			if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
			{
				indicator_switch('on');
				type = 'receive';
				param = 'mode=' + mode;	
				param += '&last_id=' + last_id;
				param += '&last_time=' + last_time;			
				param += '&last_post=' + post_time;			
				param += '&read_interval=' + read_interval;			

				if (mode == 'add' && document.postform.message.value != '')
				{
					type = 'send';
					for(var i = 0; i < f.elements.length; i++)
					{ 
						elem = f.elements[i]; 
						param += '&' + elem.name + '=' + encodeURIComponent(elem.value); 
					}
					document.postform.message.value = '';
				}
				else if (mode == 'delete')
				{
					type = 'delete';
					param += '&chat_id=' + f;
				}
				else if (mode == 'ban')
				{
					type = 'ban';
					param += '&user_id=' + f;
				}
				xmlHttp.open("POST", '{FILENAME}', true);
				xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
				xmlHttp.onreadystatechange = handle_return;
				xmlHttp.send(param);
			}
		}

		function handle_return()
		{
			if (xmlHttp.readyState == 4)
			{
				if (type != 'delete' || type != 'ban')
				{
					results = xmlHttp.responseText.split('--!--');
					if (results[1])
					{
						if (last_id == 0)
						{
							document.getElementById(fieldname).innerHTML = results[0];
						}
						else
						{
							document.getElementById(fieldname).innerHTML = results[0] + document.getElementById(fieldname).innerHTML;
						}
						last_id = results[1];
						if (results[2])
						{
							document.getElementById('whois_online').innerHTML = results[2];
							last_time = results[3];
							if (results[4] != read_interval * 1000)
							{
								window.clearInterval(interval);
								read_interval = results[4] * 1000;
								interval = setInterval('handle_send("read", last_id);', read_interval);
								document.getElementById('update_seconds').innerHTML = results[4];
							}
							post_time = results[5];
						}
					}
				}
				indicator_switch('off');
			}
		}

		function delete_post(chatid)
		{
			document.getElementById('p' + chatid).style.display = 'none';
			handle_send('delete', chatid);
		}

		function ban_user(user_id)
		{
			document.getElementById('p' + user_id).style.display = 'none';
			handle_send('ban', user_id);
		}
			
		function indicator_switch(mode)
		{
			if(document.getElementById("act_indicator"))
			{
				var img = document.getElementById("act_indicator");	
				if(img.style.visibility == "hidden" && mode == 'on') 
				{
					img.style.visibility = "visible";
				}
				else if (mode == 'off')
				{
					img.style.visibility = "hidden"
				}	
			}
		}

		function http_object()
		{
			if (window.XMLHttpRequest)
			{
				return new XMLHttpRequest();
			}
			else if(window.ActiveXObject)
			{
				try
				{
					return new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch (e)
				{
					try
					{
						return new ActiveXObject("Microsoft.XMLHTTP");
					}
					catch (e)
					{
						document.getElementById('p_status').innerHTML = 'Your version of Internet Explorer does not support AJAX.';
					}
				}
			}
			else
			{
				document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.';
			}
		}
		//-->
	</script>
	<link href="{T_STYLESHEET_LINK}" rel="stylesheet" type="text/css" media="screen, projection" />
	<link href="{T_THEME_PATH}/demon_chat.css" rel="stylesheet" type="text/css" media="screen, projection" />
		<div class="forabg">
			<div class="inner">
				<span class="corners-top"><span></span></span>
					<div class="header">
						<div style="float: left">
							<h4 style="color:white;">&nbsp;<img src="{T_THEME_PATH}/images/icon_chat.gif" alt="" />&nbsp;<!-- IF not S_CHAT --><a href="{U_CHAT}">{L_CHAT_EXPLAIN}</a><!-- ELSE -->{L_CHAT_EXPLAIN}<!-- ENDIF --></h4>
						</div>
						<div style="text-align: center">
							<!-- IF S_USER_LOGGED_IN -->
								<form>
									<!-- INCLUDE posting_buttons2.html -->
								</form>
								<form>
									<!-- IF S_SMILIES_ALLOWED and .smiley -->               
										<a class="nav" href="{U_MORE_SMILIES}" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a>
									<!-- ENDIF -->
								</form>
								<form name="postform" id="text" method="post" action="javascript:void(0);" onSubmit="handle_send('add', this)">
									<strong style="color: white;">{L_MESSAGE}:</strong> <input type="text" tabindex="1" name="message" id="message" class="inputbox chatinput" />
									<input type="submit" class="button1" value="{L_SUBMIT}" name="submit" tabindex="6" accesskey="s"/><br />
								</form>
							<!-- ELSE -->
								<b style="color: white;">You must be a Registered User to Chat in the Shoutbox</b>
							<!-- ENDIF -->
						</div>
					</div>
				<span class="corners-bottom"><span></span></span>
			</div>
		</div>
	<div align="left">
		<div class="forabg" align="left">
			<span class="corners-top"><span></span></span>
				<div class="shouts">
					<div id="chat">
						<!-- BEGIN chatrow -->
							<div id="p{chatrow.MESSAGE_ID}" class="post bg{chatrow.CLASS}">
								<div class="inner"><span class="corners-top"><span></span></span>
									<div class="postbody">
										<!-- IF U_ACP or U_MCP -->
											<ul class="profile-icons">
												<li class="delete-icon">
													<a href="javascript:void({chatrow.MESSAGE_ID})" title="{L_DELETE_POST}" onclick="delete_post('{chatrow.MESSAGE_ID}')"><span>{L_DELETE_POST}</span></a>
												</li>
											</ul>
										<!-- ENDIF -->
										<div class="content">{chatrow.MESSAGE}</div>
									</div>
									<dl class="postprofile" id="profile{postrow.POST_ID}">
										<dt>{chatrow.USERNAME_FULL}<br /><b style="font-size: 0.9em;">{chatrow.TIME}</b></dt>
									</dl>
								<span class="corners-bottom"><span></span></span></div>
							</div>
						<!-- END chatrow -->
					</div>
				</div>

				<font size="2"><strong>{L_ONLINE_LIST}:</strong></font><br />

				<div class="onlinelist bg1">
					<div class="users" id="whois_online">
						<!-- BEGIN whoisrow -->
							<div>
								<div class="inner">
									<div class="user"><img src="{T_IMAGESET_PATH}/{whoisrow.USER_STATUS}.png" class="online_img" alt="" /> {whoisrow.USERNAME_FULL}</div>
								</div>
							</div>
						<!-- END whoisrow -->
					</div>
				</div>
			<span class="corners-bottom"><span></span></span>
		</div>
	</div>
		<div class="navbar">
			<div class="inner">
				<span class="corners-top"><span></span></span>
					<div class="chatform" style="tex-align: center;padding-bottom: 4px">
						<img src="{T_IMAGESET_PATH}/act_indicator.gif" id="act_indicator" alt="" /> <strong>{L_UPDATES} <span id="update_seconds">{DELAY}</span> {L_UNIT}</strong>
					</div>
				<span class="corners-bottom"><span></span></span>
			</div>
		</div>

	<!-- IF S_CHAT -->
		<!-- IF S_DISPLAY_ONLINE_LIST -->
			<h3><!-- IF U_VIEWONLINE --><a href="{U_VIEWONLINE}">{L_WHO_IS_ONLINE}</a><!-- ELSE -->{L_WHO_IS_ONLINE}<!-- ENDIF --></h3>
			<p>{TOTAL_USERS_ONLINE} ({L_ONLINE_EXPLAIN})<br />{RECORD_USERS}<br /> <br />{LOGGED_IN_USER_LIST}</p>
		<!-- ENDIF -->
	<!-- ENDIF -->
<!-- ENDIF -->
<!-- ENDIF -->

<br />